package com.example.springaopdemo.demos.web.proxy;

import org.springframework.cglib.proxy.InvocationHandler;

import java.lang.reflect.Method;

/**
 * @author Q
 * @create 2025-06-17-9:36
 */
public class JDKInvocationHandler implements InvocationHandler {
    public Object target;

    public JDKInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("我是代理，开始代理");
        Object result = method.invoke(target,args);
        System.out.println("我是代理，结束代理");

        return result;
    }
}
